<!DOCTYPE html>
<style>
body {
  margin: 0;
  height: 2000px;
}

div {
  width: 100px;
  height: 100px;
}

#anchor {
  position: fixed;
  left: 300px;
  top: 300px;
  background: orange;
}

#anchored {
  position: fixed;
  left: 400px;
  top: 300px;
  background: green;
}

</style>

<div id="anchor"></div>
<div id="anchored"></div>

<script>
document.documentElement.scrollTop = 200;
</script>
